﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace WLive.Utils
{
    public class Settings
    {
        public static int GetSettingsInt(string cnfgname, int defaultValue)
        {
            int rvalue = 0;
            if (int.TryParse(GetSettings(cnfgname, defaultValue.ToString()), out rvalue))
                return rvalue;
            return defaultValue;
        }

        public static string GetSettings(string cnfgname, string defaultValue)
        {
            if (ConfigurationManager.AppSettings.AllKeys.Contains(cnfgname))
                return ConfigurationManager.AppSettings.Get(cnfgname);
            return defaultValue;
        }
    }
}
